/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package doan.quanlycanbo.portlet.service.persistence;

import com.liferay.portal.NoSuchModelException;
import com.liferay.portal.kernel.annotation.BeanReference;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.dao.orm.Query;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InstanceFactory;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.model.ModelListener;
import com.liferay.portal.service.persistence.BatchSessionUtil;
import com.liferay.portal.service.persistence.ResourcePersistence;
import com.liferay.portal.service.persistence.UserPersistence;
import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;

import doan.quanlycanbo.portlet.NoSuchhosoException;
import doan.quanlycanbo.portlet.model.hoso;
import doan.quanlycanbo.portlet.model.impl.hosoImpl;
import doan.quanlycanbo.portlet.model.impl.hosoModelImpl;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * The persistence implementation for the hoso service.
 *
 * <p>
 * Never modify or reference this class directly. Always use {@link hosoUtil} to access the hoso persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
 * </p>
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author Nguyen Tuan Vinh
 * @see hosoPersistence
 * @see hosoUtil
 * @generated
 */
public class hosoPersistenceImpl extends BasePersistenceImpl<hoso>
	implements hosoPersistence {
	public static final String FINDER_CLASS_NAME_ENTITY = hosoImpl.class.getName();
	public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
		".List";
	public static final FinderPath FINDER_PATH_FETCH_BY_E_G = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
			"fetchByE_G",
			new String[] { Long.class.getName(), Long.class.getName() });
	public static final FinderPath FINDER_PATH_COUNT_BY_E_G = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByE_G",
			new String[] { Long.class.getName(), Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_DONVI = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByDonVi",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_DONVI = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByDonVi", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_CHUCVU = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByChucVu",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_CHUCVU = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByChucVu", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_HOCHAM = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByHocHam",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_HOCHAM = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByHocHam", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_HOCVI = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByHocVi",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_HOCVI = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByHocVi", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_CAPUY = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByCapUy",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_CAPUY = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByCapUy", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_DANHHIEU = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByDanhHieu",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_DANHHIEU = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByDanhHieu", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_DANTOC = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByDantoc",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_DANTOC = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByDantoc", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_TONGIAO = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByTonGiao",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_TONGIAO = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByTonGiao", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_XUATTHAN = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByXuatthan",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_XUATTHAN = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByXuatthan", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_GDPT = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByGDPT",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_GDPT = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByGDPT", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_HESOLUONG = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByHeSoLuong",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_HESOLUONG = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByHeSoLuong", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findAll", new String[0]);
	public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countAll", new String[0]);

	/**
	 * Caches the hoso in the entity cache if it is enabled.
	 *
	 * @param hoso the hoso to cache
	 */
	public void cacheResult(hoso hoso) {
		EntityCacheUtil.putResult(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoImpl.class, hoso.getPrimaryKey(), hoso);

		FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_G,
			new Object[] { new Long(hoso.getMahoso()), new Long(
					hoso.getGroupId()) }, hoso);
	}

	/**
	 * Caches the hosos in the entity cache if it is enabled.
	 *
	 * @param hosos the hosos to cache
	 */
	public void cacheResult(List<hoso> hosos) {
		for (hoso hoso : hosos) {
			if (EntityCacheUtil.getResult(hosoModelImpl.ENTITY_CACHE_ENABLED,
						hosoImpl.class, hoso.getPrimaryKey(), this) == null) {
				cacheResult(hoso);
			}
		}
	}

	/**
	 * Clears the cache for all hosos.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	public void clearCache() {
		CacheRegistryUtil.clear(hosoImpl.class.getName());
		EntityCacheUtil.clearCache(hosoImpl.class.getName());
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
	}

	/**
	 * Clears the cache for the hoso.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	public void clearCache(hoso hoso) {
		EntityCacheUtil.removeResult(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoImpl.class, hoso.getPrimaryKey());

		FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_G,
			new Object[] { new Long(hoso.getMahoso()), new Long(
					hoso.getGroupId()) });
	}

	/**
	 * Creates a new hoso with the primary key. Does not add the hoso to the database.
	 *
	 * @param mahoso the primary key for the new hoso
	 * @return the new hoso
	 */
	public hoso create(long mahoso) {
		hoso hoso = new hosoImpl();

		hoso.setNew(true);
		hoso.setPrimaryKey(mahoso);

		return hoso;
	}

	/**
	 * Removes the hoso with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param primaryKey the primary key of the hoso to remove
	 * @return the hoso that was removed
	 * @throws com.liferay.portal.NoSuchModelException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso remove(Serializable primaryKey)
		throws NoSuchModelException, SystemException {
		return remove(((Long)primaryKey).longValue());
	}

	/**
	 * Removes the hoso with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param mahoso the primary key of the hoso to remove
	 * @return the hoso that was removed
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso remove(long mahoso) throws NoSuchhosoException, SystemException {
		Session session = null;

		try {
			session = openSession();

			hoso hoso = (hoso)session.get(hosoImpl.class, new Long(mahoso));

			if (hoso == null) {
				if (_log.isWarnEnabled()) {
					_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + mahoso);
				}

				throw new NoSuchhosoException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
					mahoso);
			}

			return remove(hoso);
		}
		catch (NoSuchhosoException nsee) {
			throw nsee;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso removeImpl(hoso hoso) throws SystemException {
		hoso = toUnwrappedModel(hoso);

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.delete(session, hoso);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

		hosoModelImpl hosoModelImpl = (hosoModelImpl)hoso;

		FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_G,
			new Object[] {
				new Long(hosoModelImpl.getMahoso()),
				new Long(hosoModelImpl.getGroupId())
			});

		EntityCacheUtil.removeResult(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoImpl.class, hoso.getPrimaryKey());

		return hoso;
	}

	public hoso updateImpl(doan.quanlycanbo.portlet.model.hoso hoso,
		boolean merge) throws SystemException {
		hoso = toUnwrappedModel(hoso);

		boolean isNew = hoso.isNew();

		hosoModelImpl hosoModelImpl = (hosoModelImpl)hoso;

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.update(session, hoso, merge);

			hoso.setNew(false);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

		EntityCacheUtil.putResult(hosoModelImpl.ENTITY_CACHE_ENABLED,
			hosoImpl.class, hoso.getPrimaryKey(), hoso);

		if (!isNew &&
				((hoso.getMahoso() != hosoModelImpl.getOriginalMahoso()) ||
				(hoso.getGroupId() != hosoModelImpl.getOriginalGroupId()))) {
			FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_G,
				new Object[] {
					new Long(hosoModelImpl.getOriginalMahoso()),
					new Long(hosoModelImpl.getOriginalGroupId())
				});
		}

		if (isNew ||
				((hoso.getMahoso() != hosoModelImpl.getOriginalMahoso()) ||
				(hoso.getGroupId() != hosoModelImpl.getOriginalGroupId()))) {
			FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_G,
				new Object[] {
					new Long(hoso.getMahoso()), new Long(hoso.getGroupId())
				}, hoso);
		}

		return hoso;
	}

	protected hoso toUnwrappedModel(hoso hoso) {
		if (hoso instanceof hosoImpl) {
			return hoso;
		}

		hosoImpl hosoImpl = new hosoImpl();

		hosoImpl.setNew(hoso.isNew());
		hosoImpl.setPrimaryKey(hoso.getPrimaryKey());

		hosoImpl.setMahoso(hoso.getMahoso());
		hosoImpl.setGroupId(hoso.getGroupId());
		hosoImpl.setCompanyId(hoso.getCompanyId());
		hosoImpl.setLanguageId(hoso.getLanguageId());
		hosoImpl.setUserId(hoso.getUserId());
		hosoImpl.setSohieunhanvien(hoso.getSohieunhanvien());
		hosoImpl.setCmtnd(hoso.getCmtnd());
		hosoImpl.setHoten(hoso.getHoten());
		hosoImpl.setGioitinh(hoso.getGioitinh());
		hosoImpl.setDuongdananh(hoso.getDuongdananh());
		hosoImpl.setTenthuongdung(hoso.getTenthuongdung());
		hosoImpl.setNgaysinh(hoso.getNgaysinh());
		hosoImpl.setNoisinh(hoso.getNoisinh());
		hosoImpl.setQuequan(hoso.getQuequan());
		hosoImpl.setDiachithuongtru(hoso.getDiachithuongtru());
		hosoImpl.setDiachitamtru(hoso.getDiachitamtru());
		hosoImpl.setDienthoai(hoso.getDienthoai());
		hosoImpl.setEmail(hoso.getEmail());
		hosoImpl.setQuocgia(hoso.getQuocgia());
		hosoImpl.setNgayvaodang(hoso.getNgayvaodang());
		hosoImpl.setChuyennganh1(hoso.getChuyennganh1());
		hosoImpl.setNamtncn1(hoso.getNamtncn1());
		hosoImpl.setChuyennganh2(hoso.getChuyennganh2());
		hosoImpl.setNamtncn2(hoso.getNamtncn2());
		hosoImpl.setChuyennganh3(hoso.getChuyennganh3());
		hosoImpl.setNamtncn3(hoso.getNamtncn3());
		hosoImpl.setMadonvi(hoso.getMadonvi());
		hosoImpl.setMachucvu(hoso.getMachucvu());
		hosoImpl.setMadantoc(hoso.getMadantoc());
		hosoImpl.setMahocham(hoso.getMahocham());
		hosoImpl.setMahocvi(hoso.getMahocvi());
		hosoImpl.setMahesoluong(hoso.getMahesoluong());
		hosoImpl.setMacapuy(hoso.getMacapuy());
		hosoImpl.setMatongiao(hoso.getMatongiao());
		hosoImpl.setMaxuatthan(hoso.getMaxuatthan());
		hosoImpl.setMagdpt(hoso.getMagdpt());
		hosoImpl.setMadanhhieu(hoso.getMadanhhieu());
		hosoImpl.setCotendangnhap(hoso.isCotendangnhap());
		hosoImpl.setVitri(hoso.getVitri());

		return hosoImpl;
	}

	/**
	 * Finds the hoso with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
	 *
	 * @param primaryKey the primary key of the hoso to find
	 * @return the hoso
	 * @throws com.liferay.portal.NoSuchModelException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByPrimaryKey(Serializable primaryKey)
		throws NoSuchModelException, SystemException {
		return findByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Finds the hoso with the primary key or throws a {@link doan.quanlycanbo.portlet.NoSuchhosoException} if it could not be found.
	 *
	 * @param mahoso the primary key of the hoso to find
	 * @return the hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByPrimaryKey(long mahoso)
		throws NoSuchhosoException, SystemException {
		hoso hoso = fetchByPrimaryKey(mahoso);

		if (hoso == null) {
			if (_log.isWarnEnabled()) {
				_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + mahoso);
			}

			throw new NoSuchhosoException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
				mahoso);
		}

		return hoso;
	}

	/**
	 * Finds the hoso with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param primaryKey the primary key of the hoso to find
	 * @return the hoso, or <code>null</code> if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso fetchByPrimaryKey(Serializable primaryKey)
		throws SystemException {
		return fetchByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Finds the hoso with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param mahoso the primary key of the hoso to find
	 * @return the hoso, or <code>null</code> if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso fetchByPrimaryKey(long mahoso) throws SystemException {
		hoso hoso = (hoso)EntityCacheUtil.getResult(hosoModelImpl.ENTITY_CACHE_ENABLED,
				hosoImpl.class, mahoso, this);

		if (hoso == null) {
			Session session = null;

			try {
				session = openSession();

				hoso = (hoso)session.get(hosoImpl.class, new Long(mahoso));
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (hoso != null) {
					cacheResult(hoso);
				}

				closeSession(session);
			}
		}

		return hoso;
	}

	/**
	 * Finds the hoso where mahoso = &#63; and groupId = &#63; or throws a {@link doan.quanlycanbo.portlet.NoSuchhosoException} if it could not be found.
	 *
	 * @param mahoso the mahoso to search with
	 * @param groupId the group id to search with
	 * @return the matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByE_G(long mahoso, long groupId)
		throws NoSuchhosoException, SystemException {
		hoso hoso = fetchByE_G(mahoso, groupId);

		if (hoso == null) {
			StringBundler msg = new StringBundler(6);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("mahoso=");
			msg.append(mahoso);

			msg.append(", groupId=");
			msg.append(groupId);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			if (_log.isWarnEnabled()) {
				_log.warn(msg.toString());
			}

			throw new NoSuchhosoException(msg.toString());
		}

		return hoso;
	}

	/**
	 * Finds the hoso where mahoso = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
	 *
	 * @param mahoso the mahoso to search with
	 * @param groupId the group id to search with
	 * @return the matching hoso, or <code>null</code> if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso fetchByE_G(long mahoso, long groupId) throws SystemException {
		return fetchByE_G(mahoso, groupId, true);
	}

	/**
	 * Finds the hoso where mahoso = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
	 *
	 * @param mahoso the mahoso to search with
	 * @param groupId the group id to search with
	 * @return the matching hoso, or <code>null</code> if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso fetchByE_G(long mahoso, long groupId, boolean retrieveFromCache)
		throws SystemException {
		Object[] finderArgs = new Object[] { mahoso, groupId };

		Object result = null;

		if (retrieveFromCache) {
			result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_E_G,
					finderArgs, this);
		}

		if (result == null) {
			StringBundler query = new StringBundler(3);

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_E_G_MAHOSO_2);

			query.append(_FINDER_COLUMN_E_G_GROUPID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(mahoso);

				qPos.add(groupId);

				List<hoso> list = q.list();

				result = list;

				hoso hoso = null;

				if (list.isEmpty()) {
					FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_G,
						finderArgs, list);
				}
				else {
					hoso = list.get(0);

					cacheResult(hoso);

					if ((hoso.getMahoso() != mahoso) ||
							(hoso.getGroupId() != groupId)) {
						FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_E_G,
							finderArgs, hoso);
					}
				}

				return hoso;
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (result == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_E_G,
						finderArgs);
				}

				closeSession(session);
			}
		}
		else {
			if (result instanceof List<?>) {
				return null;
			}
			else {
				return (hoso)result;
			}
		}
	}

	/**
	 * Finds all the hosos where madonvi = &#63;.
	 *
	 * @param madonvi the madonvi to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDonVi(long madonvi) throws SystemException {
		return findByDonVi(madonvi, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos where madonvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madonvi the madonvi to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDonVi(long madonvi, int start, int end)
		throws SystemException {
		return findByDonVi(madonvi, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where madonvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madonvi the madonvi to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDonVi(long madonvi, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				madonvi,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_DONVI,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_DONVI_MADONVI_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(madonvi);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_DONVI,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_DONVI,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where madonvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madonvi the madonvi to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByDonVi_First(long madonvi,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByDonVi(madonvi, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("madonvi=");
			msg.append(madonvi);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where madonvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madonvi the madonvi to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByDonVi_Last(long madonvi,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByDonVi(madonvi);

		List<hoso> list = findByDonVi(madonvi, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("madonvi=");
			msg.append(madonvi);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where madonvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param madonvi the madonvi to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByDonVi_PrevAndNext(long mahoso, long madonvi,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByDonVi_PrevAndNext(session, hoso, madonvi,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByDonVi_PrevAndNext(session, hoso, madonvi,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByDonVi_PrevAndNext(Session session, hoso hoso,
		long madonvi, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_DONVI_MADONVI_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(madonvi);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where machucvu = &#63;.
	 *
	 * @param machucvu the machucvu to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByChucVu(long machucvu) throws SystemException {
		return findByChucVu(machucvu, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos where machucvu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param machucvu the machucvu to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByChucVu(long machucvu, int start, int end)
		throws SystemException {
		return findByChucVu(machucvu, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where machucvu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param machucvu the machucvu to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByChucVu(long machucvu, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				machucvu,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_CHUCVU,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_CHUCVU_MACHUCVU_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(machucvu);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_CHUCVU,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_CHUCVU,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where machucvu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param machucvu the machucvu to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByChucVu_First(long machucvu,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByChucVu(machucvu, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("machucvu=");
			msg.append(machucvu);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where machucvu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param machucvu the machucvu to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByChucVu_Last(long machucvu,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByChucVu(machucvu);

		List<hoso> list = findByChucVu(machucvu, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("machucvu=");
			msg.append(machucvu);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where machucvu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param machucvu the machucvu to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByChucVu_PrevAndNext(long mahoso, long machucvu,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByChucVu_PrevAndNext(session, hoso, machucvu,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByChucVu_PrevAndNext(session, hoso, machucvu,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByChucVu_PrevAndNext(Session session, hoso hoso,
		long machucvu, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_CHUCVU_MACHUCVU_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(machucvu);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where mahocham = &#63;.
	 *
	 * @param mahocham the mahocham to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHocHam(long mahocham) throws SystemException {
		return findByHocHam(mahocham, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos where mahocham = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahocham the mahocham to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHocHam(long mahocham, int start, int end)
		throws SystemException {
		return findByHocHam(mahocham, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where mahocham = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahocham the mahocham to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHocHam(long mahocham, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				mahocham,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_HOCHAM,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_HOCHAM_MAHOCHAM_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(mahocham);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_HOCHAM,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_HOCHAM,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where mahocham = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahocham the mahocham to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByHocHam_First(long mahocham,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByHocHam(mahocham, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("mahocham=");
			msg.append(mahocham);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where mahocham = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahocham the mahocham to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByHocHam_Last(long mahocham,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByHocHam(mahocham);

		List<hoso> list = findByHocHam(mahocham, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("mahocham=");
			msg.append(mahocham);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where mahocham = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param mahocham the mahocham to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByHocHam_PrevAndNext(long mahoso, long mahocham,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByHocHam_PrevAndNext(session, hoso, mahocham,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByHocHam_PrevAndNext(session, hoso, mahocham,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByHocHam_PrevAndNext(Session session, hoso hoso,
		long mahocham, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_HOCHAM_MAHOCHAM_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(mahocham);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where mahocvi = &#63;.
	 *
	 * @param mahocvi the mahocvi to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHocVi(long mahocvi) throws SystemException {
		return findByHocVi(mahocvi, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos where mahocvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahocvi the mahocvi to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHocVi(long mahocvi, int start, int end)
		throws SystemException {
		return findByHocVi(mahocvi, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where mahocvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahocvi the mahocvi to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHocVi(long mahocvi, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				mahocvi,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_HOCVI,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_HOCVI_MAHOCVI_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(mahocvi);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_HOCVI,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_HOCVI,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where mahocvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahocvi the mahocvi to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByHocVi_First(long mahocvi,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByHocVi(mahocvi, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("mahocvi=");
			msg.append(mahocvi);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where mahocvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahocvi the mahocvi to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByHocVi_Last(long mahocvi,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByHocVi(mahocvi);

		List<hoso> list = findByHocVi(mahocvi, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("mahocvi=");
			msg.append(mahocvi);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where mahocvi = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param mahocvi the mahocvi to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByHocVi_PrevAndNext(long mahoso, long mahocvi,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByHocVi_PrevAndNext(session, hoso, mahocvi,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByHocVi_PrevAndNext(session, hoso, mahocvi,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByHocVi_PrevAndNext(Session session, hoso hoso,
		long mahocvi, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_HOCVI_MAHOCVI_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(mahocvi);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where macapuy = &#63;.
	 *
	 * @param macapuy the macapuy to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByCapUy(long macapuy) throws SystemException {
		return findByCapUy(macapuy, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos where macapuy = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param macapuy the macapuy to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByCapUy(long macapuy, int start, int end)
		throws SystemException {
		return findByCapUy(macapuy, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where macapuy = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param macapuy the macapuy to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByCapUy(long macapuy, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				macapuy,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_CAPUY,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_CAPUY_MACAPUY_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(macapuy);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_CAPUY,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_CAPUY,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where macapuy = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param macapuy the macapuy to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByCapUy_First(long macapuy,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByCapUy(macapuy, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("macapuy=");
			msg.append(macapuy);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where macapuy = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param macapuy the macapuy to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByCapUy_Last(long macapuy,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByCapUy(macapuy);

		List<hoso> list = findByCapUy(macapuy, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("macapuy=");
			msg.append(macapuy);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where macapuy = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param macapuy the macapuy to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByCapUy_PrevAndNext(long mahoso, long macapuy,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByCapUy_PrevAndNext(session, hoso, macapuy,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByCapUy_PrevAndNext(session, hoso, macapuy,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByCapUy_PrevAndNext(Session session, hoso hoso,
		long macapuy, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_CAPUY_MACAPUY_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(macapuy);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where madanhhieu = &#63;.
	 *
	 * @param madanhhieu the madanhhieu to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDanhHieu(long madanhhieu) throws SystemException {
		return findByDanhHieu(madanhhieu, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			null);
	}

	/**
	 * Finds a range of all the hosos where madanhhieu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madanhhieu the madanhhieu to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDanhHieu(long madanhhieu, int start, int end)
		throws SystemException {
		return findByDanhHieu(madanhhieu, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where madanhhieu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madanhhieu the madanhhieu to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDanhHieu(long madanhhieu, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				madanhhieu,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_DANHHIEU,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_DANHHIEU_MADANHHIEU_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(madanhhieu);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_DANHHIEU,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_DANHHIEU,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where madanhhieu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madanhhieu the madanhhieu to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByDanhHieu_First(long madanhhieu,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByDanhHieu(madanhhieu, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("madanhhieu=");
			msg.append(madanhhieu);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where madanhhieu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madanhhieu the madanhhieu to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByDanhHieu_Last(long madanhhieu,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByDanhHieu(madanhhieu);

		List<hoso> list = findByDanhHieu(madanhhieu, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("madanhhieu=");
			msg.append(madanhhieu);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where madanhhieu = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param madanhhieu the madanhhieu to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByDanhHieu_PrevAndNext(long mahoso, long madanhhieu,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByDanhHieu_PrevAndNext(session, hoso, madanhhieu,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByDanhHieu_PrevAndNext(session, hoso, madanhhieu,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByDanhHieu_PrevAndNext(Session session, hoso hoso,
		long madanhhieu, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_DANHHIEU_MADANHHIEU_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(madanhhieu);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where madantoc = &#63;.
	 *
	 * @param madantoc the madantoc to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDantoc(long madantoc) throws SystemException {
		return findByDantoc(madantoc, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos where madantoc = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madantoc the madantoc to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDantoc(long madantoc, int start, int end)
		throws SystemException {
		return findByDantoc(madantoc, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where madantoc = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madantoc the madantoc to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByDantoc(long madantoc, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				madantoc,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_DANTOC,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_DANTOC_MADANTOC_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(madantoc);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_DANTOC,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_DANTOC,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where madantoc = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madantoc the madantoc to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByDantoc_First(long madantoc,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByDantoc(madantoc, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("madantoc=");
			msg.append(madantoc);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where madantoc = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param madantoc the madantoc to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByDantoc_Last(long madantoc,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByDantoc(madantoc);

		List<hoso> list = findByDantoc(madantoc, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("madantoc=");
			msg.append(madantoc);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where madantoc = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param madantoc the madantoc to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByDantoc_PrevAndNext(long mahoso, long madantoc,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByDantoc_PrevAndNext(session, hoso, madantoc,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByDantoc_PrevAndNext(session, hoso, madantoc,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByDantoc_PrevAndNext(Session session, hoso hoso,
		long madantoc, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_DANTOC_MADANTOC_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(madantoc);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where matongiao = &#63;.
	 *
	 * @param matongiao the matongiao to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByTonGiao(long matongiao) throws SystemException {
		return findByTonGiao(matongiao, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			null);
	}

	/**
	 * Finds a range of all the hosos where matongiao = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param matongiao the matongiao to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByTonGiao(long matongiao, int start, int end)
		throws SystemException {
		return findByTonGiao(matongiao, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where matongiao = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param matongiao the matongiao to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByTonGiao(long matongiao, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				matongiao,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TONGIAO,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_TONGIAO_MATONGIAO_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(matongiao);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_TONGIAO,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TONGIAO,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where matongiao = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param matongiao the matongiao to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByTonGiao_First(long matongiao,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByTonGiao(matongiao, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("matongiao=");
			msg.append(matongiao);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where matongiao = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param matongiao the matongiao to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByTonGiao_Last(long matongiao,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByTonGiao(matongiao);

		List<hoso> list = findByTonGiao(matongiao, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("matongiao=");
			msg.append(matongiao);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where matongiao = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param matongiao the matongiao to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByTonGiao_PrevAndNext(long mahoso, long matongiao,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByTonGiao_PrevAndNext(session, hoso, matongiao,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByTonGiao_PrevAndNext(session, hoso, matongiao,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByTonGiao_PrevAndNext(Session session, hoso hoso,
		long matongiao, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_TONGIAO_MATONGIAO_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(matongiao);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where maxuatthan = &#63;.
	 *
	 * @param maxuatthan the maxuatthan to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByXuatthan(long maxuatthan) throws SystemException {
		return findByXuatthan(maxuatthan, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			null);
	}

	/**
	 * Finds a range of all the hosos where maxuatthan = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param maxuatthan the maxuatthan to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByXuatthan(long maxuatthan, int start, int end)
		throws SystemException {
		return findByXuatthan(maxuatthan, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where maxuatthan = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param maxuatthan the maxuatthan to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByXuatthan(long maxuatthan, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				maxuatthan,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_XUATTHAN,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_XUATTHAN_MAXUATTHAN_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(maxuatthan);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_XUATTHAN,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_XUATTHAN,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where maxuatthan = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param maxuatthan the maxuatthan to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByXuatthan_First(long maxuatthan,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByXuatthan(maxuatthan, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("maxuatthan=");
			msg.append(maxuatthan);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where maxuatthan = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param maxuatthan the maxuatthan to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByXuatthan_Last(long maxuatthan,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByXuatthan(maxuatthan);

		List<hoso> list = findByXuatthan(maxuatthan, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("maxuatthan=");
			msg.append(maxuatthan);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where maxuatthan = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param maxuatthan the maxuatthan to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByXuatthan_PrevAndNext(long mahoso, long maxuatthan,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByXuatthan_PrevAndNext(session, hoso, maxuatthan,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByXuatthan_PrevAndNext(session, hoso, maxuatthan,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByXuatthan_PrevAndNext(Session session, hoso hoso,
		long maxuatthan, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_XUATTHAN_MAXUATTHAN_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(maxuatthan);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where magdpt = &#63;.
	 *
	 * @param magdpt the magdpt to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByGDPT(long magdpt) throws SystemException {
		return findByGDPT(magdpt, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos where magdpt = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param magdpt the magdpt to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByGDPT(long magdpt, int start, int end)
		throws SystemException {
		return findByGDPT(magdpt, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where magdpt = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param magdpt the magdpt to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByGDPT(long magdpt, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				magdpt,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GDPT,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_GDPT_MAGDPT_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(magdpt);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GDPT,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GDPT,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where magdpt = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param magdpt the magdpt to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByGDPT_First(long magdpt,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByGDPT(magdpt, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("magdpt=");
			msg.append(magdpt);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where magdpt = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param magdpt the magdpt to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByGDPT_Last(long magdpt, OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByGDPT(magdpt);

		List<hoso> list = findByGDPT(magdpt, count - 1, count, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("magdpt=");
			msg.append(magdpt);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where magdpt = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param magdpt the magdpt to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByGDPT_PrevAndNext(long mahoso, long magdpt,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByGDPT_PrevAndNext(session, hoso, magdpt,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByGDPT_PrevAndNext(session, hoso, magdpt,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByGDPT_PrevAndNext(Session session, hoso hoso,
		long magdpt, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_GDPT_MAGDPT_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(magdpt);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos where mahesoluong = &#63;.
	 *
	 * @param mahesoluong the mahesoluong to search with
	 * @return the matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHeSoLuong(long mahesoluong)
		throws SystemException {
		return findByHeSoLuong(mahesoluong, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos where mahesoluong = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahesoluong the mahesoluong to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHeSoLuong(long mahesoluong, int start, int end)
		throws SystemException {
		return findByHeSoLuong(mahesoluong, start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos where mahesoluong = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahesoluong the mahesoluong to search with
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findByHeSoLuong(long mahesoluong, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				mahesoluong,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_HESOLUONG,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_HESOLUONG_MAHESOLUONG_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(mahesoluong);

				list = (List<hoso>)QueryUtil.list(q, getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_HESOLUONG,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_HESOLUONG,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first hoso in the ordered set where mahesoluong = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahesoluong the mahesoluong to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByHeSoLuong_First(long mahesoluong,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		List<hoso> list = findByHeSoLuong(mahesoluong, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("mahesoluong=");
			msg.append(mahesoluong);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last hoso in the ordered set where mahesoluong = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahesoluong the mahesoluong to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a matching hoso could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso findByHeSoLuong_Last(long mahesoluong,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		int count = countByHeSoLuong(mahesoluong);

		List<hoso> list = findByHeSoLuong(mahesoluong, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("mahesoluong=");
			msg.append(mahesoluong);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchhosoException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the hosos before and after the current hoso in the ordered set where mahesoluong = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param mahoso the primary key of the current hoso
	 * @param mahesoluong the mahesoluong to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next hoso
	 * @throws doan.quanlycanbo.portlet.NoSuchhosoException if a hoso with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public hoso[] findByHeSoLuong_PrevAndNext(long mahoso, long mahesoluong,
		OrderByComparator orderByComparator)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByPrimaryKey(mahoso);

		Session session = null;

		try {
			session = openSession();

			hoso[] array = new hosoImpl[3];

			array[0] = getByHeSoLuong_PrevAndNext(session, hoso, mahesoluong,
					orderByComparator, true);

			array[1] = hoso;

			array[2] = getByHeSoLuong_PrevAndNext(session, hoso, mahesoluong,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected hoso getByHeSoLuong_PrevAndNext(Session session, hoso hoso,
		long mahesoluong, OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_HOSO_WHERE);

		query.append(_FINDER_COLUMN_HESOLUONG_MAHESOLUONG_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(mahesoluong);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(hoso);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<hoso> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the hosos.
	 *
	 * @return the hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findAll() throws SystemException {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the hosos.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @return the range of hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findAll(int start, int end) throws SystemException {
		return findAll(start, end, null);
	}

	/**
	 * Finds an ordered range of all the hosos.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of hosos to return
	 * @param end the upper bound of the range of hosos to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of hosos
	 * @throws SystemException if a system exception occurred
	 */
	public List<hoso> findAll(int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<hoso> list = (List<hoso>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;
			String sql = null;

			if (orderByComparator != null) {
				query = new StringBundler(2 +
						(orderByComparator.getOrderByFields().length * 3));

				query.append(_SQL_SELECT_HOSO);

				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);

				sql = query.toString();
			}
			else {
				sql = _SQL_SELECT_HOSO;
			}

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				if (orderByComparator == null) {
					list = (List<hoso>)QueryUtil.list(q, getDialect(), start,
							end, false);

					Collections.sort(list);
				}
				else {
					list = (List<hoso>)QueryUtil.list(q, getDialect(), start,
							end);
				}
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
						list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Removes the hoso where mahoso = &#63; and groupId = &#63; from the database.
	 *
	 * @param mahoso the mahoso to search with
	 * @param groupId the group id to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByE_G(long mahoso, long groupId)
		throws NoSuchhosoException, SystemException {
		hoso hoso = findByE_G(mahoso, groupId);

		remove(hoso);
	}

	/**
	 * Removes all the hosos where madonvi = &#63; from the database.
	 *
	 * @param madonvi the madonvi to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByDonVi(long madonvi) throws SystemException {
		for (hoso hoso : findByDonVi(madonvi)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where machucvu = &#63; from the database.
	 *
	 * @param machucvu the machucvu to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByChucVu(long machucvu) throws SystemException {
		for (hoso hoso : findByChucVu(machucvu)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where mahocham = &#63; from the database.
	 *
	 * @param mahocham the mahocham to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByHocHam(long mahocham) throws SystemException {
		for (hoso hoso : findByHocHam(mahocham)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where mahocvi = &#63; from the database.
	 *
	 * @param mahocvi the mahocvi to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByHocVi(long mahocvi) throws SystemException {
		for (hoso hoso : findByHocVi(mahocvi)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where macapuy = &#63; from the database.
	 *
	 * @param macapuy the macapuy to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByCapUy(long macapuy) throws SystemException {
		for (hoso hoso : findByCapUy(macapuy)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where madanhhieu = &#63; from the database.
	 *
	 * @param madanhhieu the madanhhieu to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByDanhHieu(long madanhhieu) throws SystemException {
		for (hoso hoso : findByDanhHieu(madanhhieu)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where madantoc = &#63; from the database.
	 *
	 * @param madantoc the madantoc to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByDantoc(long madantoc) throws SystemException {
		for (hoso hoso : findByDantoc(madantoc)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where matongiao = &#63; from the database.
	 *
	 * @param matongiao the matongiao to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByTonGiao(long matongiao) throws SystemException {
		for (hoso hoso : findByTonGiao(matongiao)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where maxuatthan = &#63; from the database.
	 *
	 * @param maxuatthan the maxuatthan to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByXuatthan(long maxuatthan) throws SystemException {
		for (hoso hoso : findByXuatthan(maxuatthan)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where magdpt = &#63; from the database.
	 *
	 * @param magdpt the magdpt to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByGDPT(long magdpt) throws SystemException {
		for (hoso hoso : findByGDPT(magdpt)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos where mahesoluong = &#63; from the database.
	 *
	 * @param mahesoluong the mahesoluong to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByHeSoLuong(long mahesoluong) throws SystemException {
		for (hoso hoso : findByHeSoLuong(mahesoluong)) {
			remove(hoso);
		}
	}

	/**
	 * Removes all the hosos from the database.
	 *
	 * @throws SystemException if a system exception occurred
	 */
	public void removeAll() throws SystemException {
		for (hoso hoso : findAll()) {
			remove(hoso);
		}
	}

	/**
	 * Counts all the hosos where mahoso = &#63; and groupId = &#63;.
	 *
	 * @param mahoso the mahoso to search with
	 * @param groupId the group id to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByE_G(long mahoso, long groupId) throws SystemException {
		Object[] finderArgs = new Object[] { mahoso, groupId };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_E_G,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(3);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_E_G_MAHOSO_2);

			query.append(_FINDER_COLUMN_E_G_GROUPID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(mahoso);

				qPos.add(groupId);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_E_G, finderArgs,
					count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where madonvi = &#63;.
	 *
	 * @param madonvi the madonvi to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByDonVi(long madonvi) throws SystemException {
		Object[] finderArgs = new Object[] { madonvi };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_DONVI,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_DONVI_MADONVI_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(madonvi);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_DONVI,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where machucvu = &#63;.
	 *
	 * @param machucvu the machucvu to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByChucVu(long machucvu) throws SystemException {
		Object[] finderArgs = new Object[] { machucvu };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CHUCVU,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_CHUCVU_MACHUCVU_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(machucvu);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CHUCVU,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where mahocham = &#63;.
	 *
	 * @param mahocham the mahocham to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByHocHam(long mahocham) throws SystemException {
		Object[] finderArgs = new Object[] { mahocham };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_HOCHAM,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_HOCHAM_MAHOCHAM_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(mahocham);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_HOCHAM,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where mahocvi = &#63;.
	 *
	 * @param mahocvi the mahocvi to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByHocVi(long mahocvi) throws SystemException {
		Object[] finderArgs = new Object[] { mahocvi };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_HOCVI,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_HOCVI_MAHOCVI_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(mahocvi);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_HOCVI,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where macapuy = &#63;.
	 *
	 * @param macapuy the macapuy to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByCapUy(long macapuy) throws SystemException {
		Object[] finderArgs = new Object[] { macapuy };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CAPUY,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_CAPUY_MACAPUY_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(macapuy);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CAPUY,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where madanhhieu = &#63;.
	 *
	 * @param madanhhieu the madanhhieu to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByDanhHieu(long madanhhieu) throws SystemException {
		Object[] finderArgs = new Object[] { madanhhieu };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_DANHHIEU,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_DANHHIEU_MADANHHIEU_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(madanhhieu);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_DANHHIEU,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where madantoc = &#63;.
	 *
	 * @param madantoc the madantoc to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByDantoc(long madantoc) throws SystemException {
		Object[] finderArgs = new Object[] { madantoc };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_DANTOC,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_DANTOC_MADANTOC_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(madantoc);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_DANTOC,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where matongiao = &#63;.
	 *
	 * @param matongiao the matongiao to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByTonGiao(long matongiao) throws SystemException {
		Object[] finderArgs = new Object[] { matongiao };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TONGIAO,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_TONGIAO_MATONGIAO_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(matongiao);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TONGIAO,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where maxuatthan = &#63;.
	 *
	 * @param maxuatthan the maxuatthan to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByXuatthan(long maxuatthan) throws SystemException {
		Object[] finderArgs = new Object[] { maxuatthan };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_XUATTHAN,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_XUATTHAN_MAXUATTHAN_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(maxuatthan);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_XUATTHAN,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where magdpt = &#63;.
	 *
	 * @param magdpt the magdpt to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByGDPT(long magdpt) throws SystemException {
		Object[] finderArgs = new Object[] { magdpt };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GDPT,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_GDPT_MAGDPT_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(magdpt);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GDPT,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos where mahesoluong = &#63;.
	 *
	 * @param mahesoluong the mahesoluong to search with
	 * @return the number of matching hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countByHeSoLuong(long mahesoluong) throws SystemException {
		Object[] finderArgs = new Object[] { mahesoluong };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_HESOLUONG,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_HOSO_WHERE);

			query.append(_FINDER_COLUMN_HESOLUONG_MAHESOLUONG_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(mahesoluong);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_HESOLUONG,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the hosos.
	 *
	 * @return the number of hosos
	 * @throws SystemException if a system exception occurred
	 */
	public int countAll() throws SystemException {
		Object[] finderArgs = new Object[0];

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
				finderArgs, this);

		if (count == null) {
			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(_SQL_COUNT_HOSO);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
					count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Initializes the hoso persistence.
	 */
	public void afterPropertiesSet() {
		String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
					com.liferay.util.service.ServiceProps.get(
						"value.object.listener.doan.quanlycanbo.portlet.model.hoso")));

		if (listenerClassNames.length > 0) {
			try {
				List<ModelListener<hoso>> listenersList = new ArrayList<ModelListener<hoso>>();

				for (String listenerClassName : listenerClassNames) {
					listenersList.add((ModelListener<hoso>)InstanceFactory.newInstance(
							listenerClassName));
				}

				listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
			}
			catch (Exception e) {
				_log.error(e);
			}
		}
	}

	public void destroy() {
		EntityCacheUtil.removeCache(hosoImpl.class.getName());
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
	}

	@BeanReference(type = khoidonviquanlyPersistence.class)
	protected khoidonviquanlyPersistence khoidonviquanlyPersistence;
	@BeanReference(type = donviPersistence.class)
	protected donviPersistence donviPersistence;
	@BeanReference(type = chucvuPersistence.class)
	protected chucvuPersistence chucvuPersistence;
	@BeanReference(type = capuyPersistence.class)
	protected capuyPersistence capuyPersistence;
	@BeanReference(type = danhhieuPersistence.class)
	protected danhhieuPersistence danhhieuPersistence;
	@BeanReference(type = dantocPersistence.class)
	protected dantocPersistence dantocPersistence;
	@BeanReference(type = hochamPersistence.class)
	protected hochamPersistence hochamPersistence;
	@BeanReference(type = hocviPersistence.class)
	protected hocviPersistence hocviPersistence;
	@BeanReference(type = tongiaoPersistence.class)
	protected tongiaoPersistence tongiaoPersistence;
	@BeanReference(type = xuatthanPersistence.class)
	protected xuatthanPersistence xuatthanPersistence;
	@BeanReference(type = giaoducphothongPersistence.class)
	protected giaoducphothongPersistence giaoducphothongPersistence;
	@BeanReference(type = ngachluongPersistence.class)
	protected ngachluongPersistence ngachluongPersistence;
	@BeanReference(type = hesoluongPersistence.class)
	protected hesoluongPersistence hesoluongPersistence;
	@BeanReference(type = hosoPersistence.class)
	protected hosoPersistence hosoPersistence;
	@BeanReference(type = sachxuatbanPersistence.class)
	protected sachxuatbanPersistence sachxuatbanPersistence;
	@BeanReference(type = dienbienhochamPersistence.class)
	protected dienbienhochamPersistence dienbienhochamPersistence;
	@BeanReference(type = dienbienhocviPersistence.class)
	protected dienbienhocviPersistence dienbienhocviPersistence;
	@BeanReference(type = dienbienluongPersistence.class)
	protected dienbienluongPersistence dienbienluongPersistence;
	@BeanReference(type = quatrinhdinuocngoaiPersistence.class)
	protected quatrinhdinuocngoaiPersistence quatrinhdinuocngoaiPersistence;
	@BeanReference(type = quatrinhnghiencuuPersistence.class)
	protected quatrinhnghiencuuPersistence quatrinhnghiencuuPersistence;
	@BeanReference(type = ResourcePersistence.class)
	protected ResourcePersistence resourcePersistence;
	@BeanReference(type = UserPersistence.class)
	protected UserPersistence userPersistence;
	private static final String _SQL_SELECT_HOSO = "SELECT hoso FROM hoso hoso";
	private static final String _SQL_SELECT_HOSO_WHERE = "SELECT hoso FROM hoso hoso WHERE ";
	private static final String _SQL_COUNT_HOSO = "SELECT COUNT(hoso) FROM hoso hoso";
	private static final String _SQL_COUNT_HOSO_WHERE = "SELECT COUNT(hoso) FROM hoso hoso WHERE ";
	private static final String _FINDER_COLUMN_E_G_MAHOSO_2 = "hoso.mahoso = ? AND ";
	private static final String _FINDER_COLUMN_E_G_GROUPID_2 = "hoso.groupId = ?";
	private static final String _FINDER_COLUMN_DONVI_MADONVI_2 = "hoso.madonvi = ?";
	private static final String _FINDER_COLUMN_CHUCVU_MACHUCVU_2 = "hoso.machucvu = ?";
	private static final String _FINDER_COLUMN_HOCHAM_MAHOCHAM_2 = "hoso.mahocham = ?";
	private static final String _FINDER_COLUMN_HOCVI_MAHOCVI_2 = "hoso.mahocvi = ?";
	private static final String _FINDER_COLUMN_CAPUY_MACAPUY_2 = "hoso.macapuy = ?";
	private static final String _FINDER_COLUMN_DANHHIEU_MADANHHIEU_2 = "hoso.madanhhieu = ?";
	private static final String _FINDER_COLUMN_DANTOC_MADANTOC_2 = "hoso.madantoc = ?";
	private static final String _FINDER_COLUMN_TONGIAO_MATONGIAO_2 = "hoso.matongiao = ?";
	private static final String _FINDER_COLUMN_XUATTHAN_MAXUATTHAN_2 = "hoso.maxuatthan = ?";
	private static final String _FINDER_COLUMN_GDPT_MAGDPT_2 = "hoso.magdpt = ?";
	private static final String _FINDER_COLUMN_HESOLUONG_MAHESOLUONG_2 = "hoso.mahesoluong = ?";
	private static final String _ORDER_BY_ENTITY_ALIAS = "hoso.";
	private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No hoso exists with the primary key ";
	private static final String _NO_SUCH_ENTITY_WITH_KEY = "No hoso exists with the key {";
	private static Log _log = LogFactoryUtil.getLog(hosoPersistenceImpl.class);
}